﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="slideadd.aspx.cs"
    Inherits="weikeweixin.web.admin.website.slideadd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="Keywords" content="IdeaSoft软件 二维码" />
    <meta name="Description" content="IdeaSoft软件 二维码" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css?v=<%=Application["v"] %>" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css?v=<%=Application["v"] %>" />
    <link href="/css/Bootstrap/todc_bootstrap.css?v=<%=Application["v"] %>" rel="stylesheet"
        type="text/css" />
    <link href="/css/Bootstrap/resource.css?v=<%=Application["v"] %>" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css?v=<%=Application["v"] %>" />
    <script type="text/javascript" src="/Scripts/JQuery.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.wizard.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/Bootstrap.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.validate.min.js?v=<%=Application["v"] %>"></script>
    <script type="text/javascript" src="/Scripts/JQuery.validate.methods.js?v=<%=Application["v"] %>"></script>
    <script src="/Scripts/resource.js?v=<%=Application["v"] %>" type="text/javascript"></script>
    <script type="text/javascript" src="/Scripts/Inside.js?v=<%=Application["v"] %>"></script>
    <script src="/Scripts/UploadImg.js?v=<%=Application["v"] %>" type="text/javascript"></script>
    <script>        var value = "";</script>
    <title>IdeaSoft软件</title>
</head>
<body>
    <div id="main">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="box">
                        <div class="box-title">
                            <div class="span10">
                                <h3>
                                    <i class="icon-edit"></i>添加幻灯片</h3>
                            </div>
                            <div class="span2">
                                <a class="btn" href="Javascript:window.history.go(-1)">返回</a></div>
                        </div>
                        <form action="slideadd.aspx" method="post" class="form-horizontal form-validate">
                        <input type="hidden" name="action" value="bindhomeadd" />
                        <%if (Request.QueryString["Id"] != null)
                          { %>
                        <input name="id" value="<%=Request.QueryString["Id"]%>" style="display: none;" />
                        <%} %>
                        <div class="box-content">
                            <div class="control-group">
                                <label for="name" class="control-label">
                                    幻灯片名称：</label>
                                <div class="controls">
                                    <input type="text" id="name" name="name" value="<%=Name %>" class="input-medium"
                                        data-rule-required="true" data-rule-maxlength="50" />
                                    <span class="maroon">*</span><span class="help-inline"></span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="discription" class="control-label">
                                    幻灯片描述：</label>
                                <div class="controls">
                                    <textarea id="description" name="description" rows="2" class="input-xxlarge" data-rule-maxlength="255"
                                        placeholder="最多255个字符"><%=Description%></textarea>
                                    <span class="maroon">*</span><span class="help-inline"></span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="sort" class="control-label">
                                    显示顺序：</label>
                                <div class="controls">
                                    <input type="text" id="sort" name="sort" value="<%=Sort %>" class="input-mini" data-rule-required="true"
                                        data-rule-number="true" />
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="insertimage" class="control-label">
                                    幻灯片封面:</label>
                                <div class="controls">
                                    <img type="img" id="urlshow" src="<%=PicUrl %>" style="max-height: 50px;" />
                                    <input type="hidden" id="urlhidden" name="picurl" value="<%=PicUrl %>" class="input-medium" />
                                    <a class="btn insertimage" id="select_cover_img">选择幻灯片</a> <span class="help-inline">
                                        建议尺寸：宽640像素，高425像素</span>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">
                                    是否显示：</label>
                                <div class="controls" id="Status">
                                    <script type="text/javascript">
                                        $(function () {
                                            $("#Status").val("<%=Status %>");
                                        })
                                    </script>
                                    <%if (Convert.ToInt32(Status) == 0)
                                      { %>
                                    <label class="radio inline">
                                        <input type="radio" value="1" name="is_show" />显示</label>
                                    <label class="radio inline">
                                        <input type="radio" value="0" name="is_show" checked="checked" />隐藏</label><%}
                                      else
                                      {%>
                                    <label class="radio inline">
                                        <input type="radio" value="1" name="is_show" checked="checked" />显示</label>
                                    <label class="radio inline">
                                        <input type="radio" value="0" name="is_show" />隐藏</label><%} %>
                                </div>
                            </div>
                            <div id="res_block">
                                <div class="control-group">
                                    <label for="type" class="control-label">
                                        类型：</label>
                                    <div class="controls">
                                        <script type="text/javascript">
                                            $(function () {
                                                $.ajax({
                                                    url: "newsclass.aspx?action=list",
                                                    type: "post",
                                                    success: function (msg) {
                                                        msg = eval("(" + msg + ")");
                                                        var str = "";
                                                        $(msg).each(function (i) {
                                                            str += "<option value=\"" + msg[i].CId + "\">" + msg[i].CName + "</option>";
                                                        });
                                                        $("#category_id,#category_id2").append(str);
                                                        var type = '<%=Type %>';
                                                        var Href = '<%=Href %>';
                                                        $("#type").val(type);
                                                        switch (type) {
                                                            case "articlelist":
                                                                $("#r_articlelist").css("display", "block");
                                                                $("#category_id").val(Href.replace("http://" + window.location.host + "/phone/List?user_id=" + "<%=user_id %>&cid=", ""));
                                                                break;
                                                            case "article":
                                                                $("#r_article").css("display", "block");
                                                                Href = Href.replace("http://" + window.location.host + "/phone/News?user_id=" + "<%=user_id %>&nid=", "");
                                                                $("#article").val(Href);
                                                                value = Href;
                                                                break;
                                                            case "link":
                                                                $("#r_link").css("display", "block");
                                                                $("#link").val(Href);
                                                                break;
                                                            case "tel":
                                                                $("#r_tel").css("display", "block");
                                                                $("#tel").val(Href.replace("tel:", ""));
                                                                break;
                                                            default:
                                                                $("#r_articlelist").css("display", "block");
                                                                $("#category_id").val(Href.replace("http://" + window.location.host + "/phone/List?user_id=" + "<%=user_id %>&cid=", ""));
                                                                break;
                                                        }
                                                    }
                                                });
                                            })
                                        </script>
                                        <select id="type" name="type" class="input-medium">
                                            <option value="articlelist">图文分类</option>
                                            <option value="article">图文</option>
                                            <option value="link">链接</option>
                                            <option value="tel">电话</option>
                                        </select>
                                    </div>
                                </div>
                                <div id="r_articlelist" class="control-group r-module hide">
                                    <div class="control-group">
                                        <label class="control-label">
                                            图文分类
                                        </label>
                                        <div class="controls">
                                            <select id="category_id" name="category_id" class="input-medium valid">
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div id="r_article" class="control-group r-module hide">
                                    <div class="control-group">
                                        <label class="control-label">
                                        </label>
                                        <div class="controls">
                                            <span id="lbl_article" class="maroon">请选择图文</span><a href="#" onclick="javascript:$('#article_list').removeClass('hide')"
                                                class="icon-edit">
                                                <input id="article" name="article" value="" class="input-xlarge" data-rule-required="true"
                                                    data-rule-url="true" type="text" style="display: none;">点击选择图文 </a>
                                            <div id="article_list" class="hide">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                                        &times;</button>
                                                    <h4 class="modal-title">
                                                        <i class="icon-table"></i>选择图文</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="row-fluid">
                                                        图文标题：<input name="key" id="title" type="text" class="input-medium" placeholder="输入标题进行查找" />
                                                        <select name="classid" id="category_id2" class="input-medium">
                                                            <option value="0">请选择图文分类</option>
                                                        </select>
                                                        <button type="button" class="btn" id="btn_search">
                                                            <strong>查找</strong></button>
                                                    </div>
                                                    <p>
                                                    </p>
                                                    <div class="row-fluid">
                                                        <%--共有 <span class="red" id="Span1">0</span> 条符合条件　
							<button type="button" class="btn btn-mini" id="Button2"><strong>上一页</strong></button>
							<span id="Span2">第1页/共1页</span>
							<button type="button" class="btn btn-mini" id="Button3"><strong>下一页</strong></button>--%>
                                                        <ul class="unstyled list-li-border" id="data-list">
                                                        </ul>
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button id="btn_article" type="button" class="btn btn-primary" data-dismiss="modal">
                                                        确定</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div id="r_link" class="control-group r-module hide">
                                    <div class="control-group">
                                        <label class="control-label" for="link">
                                            外链地址</label>
                                        <div class="controls">
                                            <input type="url" id="link" name="link" value="" class="input-xlarge" data-rule-required="true"
                                                data-rule-url="true" />
                                            <span class="maroon">*</span><span class="help-inline">(必填，必须是正确的URL格式)</span>
                                        </div>
                                    </div>
                                </div>
                                <div id="r_tel" class="control-group r-module hide">
                                    <div class="control-group">
                                        <label class="control-label" for="tel">
                                            电话号码</label>
                                        <div class="controls">
                                            <input type="text" id="tel" name="tel" value="" class="input-large" data-rule-required="true"
                                                data-rule-phone="true" />
                                            <span class="maroon">*</span><span class="help-inline">(必填，必须是正确的号码)</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary">
                                        保存</button>
                                    <button type="button" class="btn" onclick="window.history.go(-1);">
                                        取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
</body>
<script>
    $(function () {
        $("#select_cover_img").initUpload({ showID: 'urlshow', hideID: 'urlhidden', savePath: 'VIPCardConfig&dir=image' });
    })
    $(document).ready(function () {
        var resource = Resource.create();
        var ins = Resource.instance['res_block'];
        ins.result = ins.result || {};
        ins.result.wuid = 26438;


        window.ICON();
    });

    
</script>
<script>
    window.document.onkeydown = function (e) {
        if ('' == document.activeElement.id) {
            var e = e || event;
            var currKey = e.keyCode || e.which || e.charCode;
            if (8 == currKey) {
                return false;
            }
        }
    };
    $(function () {
        getNews();
        $("#btn_search").click(function () {
            getNews();
        });
        $("#btn_article").click(function () {
            $("input[name='radio']").each(function (i) {
                if (this.checked) {
                    alert("你选择了" + $(this).attr("data-title"));
                    $("#lbl_article").html($(this).attr("data-title"));
                    $("#article").val($(this).val());
                    $("#article_list").addClass("hide");
                }
            });
        });
    })
    function getNews() {
        $.ajax({
            url: "news.aspx?action=list2",
            type: "post",
            data: { cid: $("#category_id2").val().replace("0", ""), title: $("#title").val() },
            success: function (msg) {
                msg = eval("(" + msg + ")");
                var str = "";
                $(msg).each(function (i) {
                    if (value == msg[i].NId) {
                        $("#lbl_article").html(msg[i].NTitle);
                    }
                    str += "<li> <label> <input type=\"radio\" value=\"" + msg[i].NId + "\" data-title=\"" + msg[i].NTitle + "\" name=\"radio\">" + msg[i].NTitle + "</label></li>";
                });
                $("#data-list").html(str);
            }
        });
    }
</script>
</html>
